# Maintainer: Caleb Maclennan <caleb@alerque.com>

pkgbase=lua-mediator
_rockname=${pkgbase#lua-}
_project=${_rockname}_lua
pkgname=("lua-$_rockname" "lua53-$_rockname" "lua52-$_rockname" "lua51-$_rockname")
pkgver=1.1.2
_rockrel=0
pkgrel=6
pkgdesc='Event handling through channels'
arch=(any)
url="https://olivinelabs.com/$_project/"
license=(MIT)
makedepends=(lua
             lua51
             lua52
             lua53
             luarocks)
checkdepends=(busted)
_archive="$_project-$pkgver-$_rockrel"
source=("https://github.com/Olivine-Labs/$_project/archive/v$pkgver-$_rockrel/$_archive.tar.gz")
sha256sums=('faf5859fd2081be4e9e4fb8873a2dc65f7eff3fd93d6dd14da65f8e123fcff9b')

check() {
	cd "$_archive"
	busted
}

_package() {
	cd "$_archive"
	depends=("${pkgname%-*}")
	luarocks --lua-version="$1" --tree="$pkgdir/usr/" \
		make --deps-mode=none --no-manifest "$_archive.rockspec"
}

package_lua-mediator() {
  _package 5.4
}

package_lua51-mediator() {
  _package 5.1
}

package_lua52-mediator() {
  _package 5.2
}

package_lua53-mediator() {
  _package 5.3
}
